# _*_ coding: utf-8 _*_
# @Time : 2021/3/31 0031 1:56
# @Author : 夕木酱
import requests

"""请求方法的封装"""


class request:
    def request(self, url, method='post', **kwargs):
        '''
        :param url: 请求地址
        :param method: 请求方法
        :param kwargs: 请求参数
        :return:
        '''
        if method == 'post':
            return requests.request(url=url, method=method, **kwargs)
        elif method == 'get':
            return request.request(url=url, method='get', **kwargs)
        elif method == 'put':
            return requests.request(url=url, method='put', **kwargs)
        elif method == 'delete':
            return request.request(url=url, method='delete', **kwargs)

    def post(self, url, **kwargs):
        return self.request(url=url, method='post', **kwargs)

    def get(self, url, **kwargs):
        return self.request(url=url, **kwargs)

    def put(self, url, **kwargs):
        return self.request(url=url, method='put', **kwargs)

    def delete(self, url, **kwargs):
        return self.request(url=url, method='delete', **kwargs)